#ifndef dq_EventManager_h
#define dq_EventManager_h

#include "Singleton.h"
#include <utility/EventManager.h>
#include <utility//Event.h>
#include <utility/EventType.h>

namespace serika
{
	namespace ut
	{
		class EventHandler;
	}

	namespace dq
	{
		class EventManager
		{
		public:
			static void Close()
			{
				EvnMgrSngl::Close();
			}

			static void AttachHandler(int eventType, ut::EventHandler* handler)
			{
				EvnMgrSngl::Instance()->AttachEventHandler(eventType, handler);
			}

			static void DetachHandler(int eventType, ut::EventHandler* handler)
			{
				EvnMgrSngl::Instance()->DetachEventHandler(eventType, handler);
			}

			static void AttachUiEventHandler(ut::EventHandler* handler)
			{
				EventManager::AttachHandler(ut::EventType::UI, handler);
			}

			static void DetachUiEventHandler(ut::EventHandler* handler)
			{
				EventManager::DetachHandler(ut::EventType::UI, handler);
			}

			static void AttachLogicEventHandler(ut::EventHandler* handler)
			{
				EventManager::AttachHandler(ut::EventType::Logic, handler);
			}

			static void DetachLogicEventHandler(ut::EventHandler* handler)
			{
				EventManager::DetachHandler(ut::EventType::Logic, handler);
			}

			static void SendEvent(ut::Event* e)
			{
				EvnMgrSngl::Instance()->SendEvent(e);
			}

			static void SendEvent(int eventType, int eventCode)
			{
				ut::Event* e = ut::Event::NewEvent(eventType, eventCode);
				EvnMgrSngl::Instance()->SendEvent(e);
			}

		private:
			typedef Singleton<ut::EventManager> EvnMgrSngl;
		};
	}
}

#endif
